package exercise.day11;
import java.util.*;

/**
 * @author Dianzhi Han
 * @version 1.0
 * @description: TODO
 * @date 2022/11/13 21:04
 */
public class HJ86_MaxContinuousBit {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int num = in.nextInt();
        StringBuilder ret = new StringBuilder();
        int sum = 0; //连续1的个数
        int temp = 0;
        if(num == 1){
            sum=1;
        }
        while(num != 0){
            ret.insert(0, num % 2);
            num = num/2;
        }
        //此时ret为二进制字符串

        for(int i = 0;i<ret.length();i++){
            char ch = ret.charAt(i);
            if(ch == '1'){
                temp++;
            }else{
                temp =0;
            }
            if(temp > sum){
                sum = temp;
            }
        }

        System.out.print(sum);

    }
}
